//
//  SelectedGoodTableViewCell.m
//  HAODE
//
//  Created by LiYinDi on 16/1/12.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "SelectedGoodTableViewCell.h"

@implementation SelectedGoodTableViewCell

- (void)awakeFromNib {
    _productImageView.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1] CGColor];
    _productImageView.layer.borderWidth= 1.0f;
    _productImageView.layer.masksToBounds = YES;
    _productImageView.layer.cornerRadius=5;
    [self setAutoLayout];
}
 - (IBAction)subtractBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(subtractBtnClick:)]) {
        
        [self.delegate subtractBtnClick:sender.tag];
    }
}
-(void)setAutoLayout
{
    [_productImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@70);
        make.height.equalTo(@70);
        make.left.equalTo(self.mas_left).with.offset(5);
        make.top.equalTo(self.mas_left).with.offset(20);
    }];
    [_productNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_productImageView.mas_right).with.offset(8);
        make.right.equalTo(self.mas_right).with.offset(5);
        make.height.equalTo(@18);
        
        make.top.equalTo(_productImageView.mas_top) ;
    }];
   
    [_countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_productImageView.mas_left) ;
        make.width.equalTo(@30) ;
        make.height.equalTo(@15);
        
        make.bottom.equalTo(_productImageView.mas_bottom) ;
    }];
    [_subtractBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.left.equalTo(_productImageView.mas_right).with.offset(5);
        make.right.equalTo(self.mas_right);
        make.height.equalTo(@38);
        make.width.equalTo(@38);
        make.centerY.equalTo(_productImageView.mas_centerY);
    }];
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_productImageView.mas_right).with.offset(8);
        make.right.equalTo(self.mas_right).with.offset(5);
        make.height.equalTo(@15);
        
        make.bottom.equalTo(_productImageView.mas_bottom);
    }];
    [_specNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_productImageView.mas_right).with.offset(8);
        make.right.equalTo(self.mas_right);
        make.height.equalTo(@21);
        make.top.equalTo(_productNameLabel.mas_bottom);
        //make.centerY.equalTo(_outsideAddBtn.mas_centerY);
    }];

    
    [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left) ;
        make.right.equalTo(self.mas_right) ;
        make.height.equalTo(@1);
        make.bottom.equalTo(self.mas_bottom);
        //make.centerY.equalTo(_outsideAddBtn.mas_centerY);
    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
